/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.cheln.explorer.cpnt.adapter;

import android.view.View;

import com.direction.hold.ui.CommonActivity;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

/**
 *
 * @author Administrator
 */
public class SelectedIndicator {

    public static Map<Class<? extends CommonActivity>, CommonActivity> clearState = new HashMap<Class<? extends CommonActivity>, CommonActivity>();

    public static void putSelected(CommonActivity activity) {
        clearState.put(activity.getClass(), activity);
    }

    public static void clearOthersSelectionState(CommonActivity currActivity) {
        Boolean isClear;
        Class<? extends CommonActivity> activityClazz = null;
        CommonActivity activity = null;
        for (Entry<Class<? extends CommonActivity>, CommonActivity> en : clearState.entrySet()) {
            isClear = en.getValue()==null;
            activity = en.getValue();
            activityClazz = en.getKey();
            if (isClear || activityClazz == currActivity.getClass()) {
                continue;
            }
            activity.makeSelectAll(false, true);
            activity.showBottomBar(View.GONE);
            clearState.put(activity.getClass(), activity);
        }
    }
}
